﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IceDog.DNL.CSharp.DesignPattern.SingletonPattern.Message
{
    /// <summary>
    /// 懒汉式-线程不安全
    /// </summary>
    public class MessageManager
    {
        private MessageManager()
        {
            InitCounter += 1;
        }

        private static MessageManager _manager;
        public static int InitCounter;
        public static MessageManager Instance
        {
            get
            {
                if (_manager==null)
                {
                    _manager=new MessageManager();
                }
                return _manager;
            }
        }

        public string GetMessage()
        {
            return "Message : Hello World";
        }
    }
}
